Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for recursion when max_proofs_verified = 1 #11698

Merged
merged 28 commits into from
Nov 10, 2022
Merged

Conversation

imeckler
Copy link
Member

This fixes a long-standing issue related to verifying proofs that have max_proofs_verified=1 via Pickles.Proof.of_side_loaded.

The issue was that the accumulators of the proofs were being padded at the back of the list of commitments/challenges in certain parts of the code, but padded at the front of the list in others. This changes all padding to happen at the front of the list for compatibility with a sponge-state pre-computation optimization.

Previously, this bug was not uncovered because it had only been tested with max_proofs_verified= 0 or 2, in which case padding at the front and the back are identical.

Izaak Meckler added 2 commits August 23, 2022 09:42
…th the Wrap_hack. previously this was working because we had only tested it with 2 or 0 max_proofs_verified, in which cases padding at the front or at the back are identical
@imeckler imeckler requested a review from a team as a code owner August 23, 2022 16:46
@mrmr1993 mrmr1993 added the ci-build-me Add this label to trigger a circle+buildkite build for this branch label Aug 24, 2022
@mrmr1993
Copy link
Member

Merged develop here to (hopefully) fix the nix CI failures.

@imeckler imeckler requested a review from a team as a code owner October 12, 2022 18:39
@mrmr1993
Copy link
Member

!ci-build-me

@mrmr1993
Copy link
Member

mrmr1993 commented Nov 2, 2022

!ci-build-me

@imeckler
Copy link
Member Author

imeckler commented Nov 9, 2022

!ci-build-me

@imeckler
Copy link
Member Author

imeckler commented Nov 9, 2022

!ci-build-me

1 similar comment
@mitschabaude
Copy link
Member

!ci-build-me

@imeckler
Copy link
Member Author

imeckler commented Nov 9, 2022

!ci-build-me

@imeckler
Copy link
Member Author

imeckler commented Nov 9, 2022

!ci-build-me

@imeckler imeckler merged commit 51ca4f4 into develop Nov 10, 2022
@imeckler imeckler deleted the fix-for-recursion branch November 10, 2022 06:33
@@ -619,8 +619,16 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct
~f:Fn.id
in
let snark_work_event_subscription =
Event_router.on (event_router t) Snark_work_gossip ~f:(fun _ _ ->
[%log info] "Received new snark work" ;
Event_router.on (event_router t) Snark_work_gossip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should revert this, since it's fairly heavy, and only for debugging.

@@ -194,6 +194,14 @@ module Make_str (_ : Wire_types.Concrete) = struct
local_max_proofs_verifieds
H1.T(Proof_.Messages_for_next_proof_over_same_field.Wrap).t ) =
let dummy_chals = Dummy.Ipa.Wrap.challenges in
let rev_magic :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix the iterator below and remove this. Best not to lie to the typechecker!

go M.maxes messages_for_next_wrap_proofs
rev_magic
(go
(Obj.magic (List.rev (Obj.magic M.maxes)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

@@ -333,7 +344,9 @@ module Make_str (_ : Wire_types.Concrete) = struct
=
fun rule ->
let (T (_, l)) = HT.length rule.prevs in
Vector.extend_exn (V.f l (M.f rule.prevs)) Max_proofs_verified.n 0
Vector.extend_front_exn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a pity that we had to reverse all of these; probably there was just one place that was wrong before. (No need to change now though, since this works as written.)

exists
(Vector.typ'
(Vector.map
~f:(fun uses_lookup ->
Unfinalized.typ ~wrap_rounds:Backend.Tock.Rounds.n
~uses_lookup )
(Vector.extend lookup_usage lte Max_proofs_verified.n No) ) )
lookup_usage
(* Vector.extend lookup_usage lte Max_proofs_verified.n No *) ) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

src/lib/pickles/step_main.ml Show resolved Hide resolved
@@ -106,3 +106,10 @@ let typ ~wrap_rounds ~uses_lookup : (t, Constant.t) Typ.t =
(Shifted_value.typ Other_field.typ)
~assert_16_bits:(Step_verifier.assert_n_bits ~n:16)
~zero:Common.Lookup_parameters.tick_zero ~uses_lookup

let dummy () : t =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: memo-ize?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
berkeley-rampup ci-build-me Add this label to trigger a circle+buildkite build for this branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants